import http from "../ts/http";
import type { HomeData, DetailType, ListType, LatestType, ReadData, HotWordType, SearchData, MaleRankData, MaleClassifyData, } from '@/typings'
export const Api = {
    getHome: () => {
        return http.get<HomeData>('store/show.json')
    },
    getBanner: () => {
        return http.get<HomeData>('store/show.json?type=publish&uuid=b5648dd3c4f24d9796f590cd81ca076e')
    },
    getFemale: () => {
        return http.get<HomeData>('store/show.json?type=femail&uuid=017de2274aa5400e9dabe30f173e98d9')
    },
    getClassify: () => {
        return http.get('simpleCategroy.json')
    },
    getFreeMale: () => {
        return http.get<HomeData>('store/show.json?type=free&uuid=ea81f0be96a74d4fa7c674b9252a9ef4')
    },
    getFreeFemal: () => {
        return http.get<HomeData>('store/show.json?type=female_free&uuid=19ef3f613db44231983a48a570fc0a9a')
    },
    getDetail: (id: string, title: string) => {
        return http.get<DetailType>(`book/getsub.json?id=${id}&title=${title}`)
    },
    getLatest: (id: string) => {
        return http.get<LatestType>(`book/simpleInfo.json?id=${id}`)
    },
    getList: (id: string) => {
        return http.get<ListType>(`reader/book/info.json?source_uuid=${id}`)
    },
    getContent: (id: string, secid: string) => {
        return http.get<ReadData>(`reader/book/content.json?source_uuid=${id}&content_uuid=${secid}`)
    },
    getHotWords: () => {
        return http.get<HotWordType>('search/getHotWords')
    },
    getSearch: (keyword: string) => {
        return http.get<SearchData>(`search/book.json?keyword=${keyword}`)
    },
    getMaleRank: () => {
        return http.get<MaleRankData>('rank/original/list/data.json?gender=male&sortType=day&type=sell')
    },
    getFemaleRank: () => {
        return http.get<MaleRankData>('rank/original/list/data.json?gender=female&sortType=day&type=sell')
    },
    getBookRank: () => {
        return http.get<MaleRankData>('rank/publish/list/data.json')
    },
    getMaleClassify: (id: string, channel: string) => {
        return http.get<MaleClassifyData>(`category/original/data.json?id=${id}&gender=${channel}`)
    },
    getPublishBook: (id: string) => {
        return http.get(`category/publish/data.json?id=${id}`)
    }

}